using System;
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;

public class QuadSetting : ScriptableObject
{
    private static QuadSetting _instance;

    public static QuadSetting Instance
    {
        get
        {
            if (_instance == null)
            {
                getSetting(); 
            }

            return _instance;
        }
    }

    private static string settingPath = "Assets/QuadSetting.asset";

    [MenuItem("Tools/Create QuadPSetting #q")]
    public static void CreateInstance()
    {
        if (_instance != null)
            return;

        var setting = ScriptableObject.CreateInstance<QuadSetting>();
        _instance = setting;
        AssetDatabase.CreateAsset(setting, settingPath);
        AssetDatabase.SaveAssets();
        AssetDatabase.Refresh();
    }

    private static void getSetting()
    {
        var i = AssetDatabase.LoadAssetAtPath<QuadSetting>(settingPath);
        if (i == null)
            CreateInstance();
        _instance = AssetDatabase.LoadAssetAtPath<QuadSetting>(settingPath);
    }

    #region Pivot
    
    [Header("Pivots")]
    [Range(0,2f)]
    public float pivotR = 0.3f;
    public Color PivotColor;

    #endregion
    
    [Header("Test Part")]
    [Range(0, 2f)]
    public float TestPointRadius;
    public Color TestPointColor;
    public Color TestPointOverColor;
    
    [Header("Line")]    
    // 默认线颜色
    public Color DefaultLineColor;
    
    // 测试用数据
    [Header("For test")]
    public int TestCount = 10;

    // 可视区域要求
    public float TestRadius;
    public Vector2 VisibleSize;
    public Color VisibleAreaLine;
    public Color VisibleCenterColor;
    public Color VisibleCenterDragColor;
}
